import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";

function Count(props) {
  return <div className="count">{props.count}</div>;
}
class App extends React.Component {
  constructor(porps) {
    super(porps);
    this.state = {
      count: 0,
    };
    setInterval(() => {
      this.setState({
        count: this.state.count + 1,
      });
    }, 2000);
  }
  addCount() {
    this.setState({
      count: this.state.count + 1,
    });
  }
  render() {
    return (
      <>
        <div className="App" onClick={this.addCount.bind(this)}>
          {this.props.name}
        </div>
        <Count count={this.state.count} />
      </>
    );
  }
}
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<App name="job day02" />);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
